package com.dingding.thirdpartydingding.util;

import org.springframework.http.ResponseEntity;
import org.springframework.util.Assert;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import java.net.URI;

public class WebUtils {
		public static ResponseEntity<Void> deletedResponse() {
				return ResponseEntity.noContent().build();
		}

		/**
		 * @param id persistence entity id
		 * @return URI location
		 */
		public static URI toLocation(Object id) {
				Assert.notNull(id, "id can't be null");
				return ServletUriComponentsBuilder
						.fromCurrentRequest()
						.path("/{id}")
						.buildAndExpand(id)
						.toUri();
		}
}
